<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件绑定</title>
</head>
<body>
<div>
    <div class="v1">1</div>
    <div class="v1">2</div>
    <div class="v1">3</div>
    <div class="v1">4</div>
    <div class="v1">5</div>
    <p id="p1" onclick="func(this)">点我呀</p>
</div>

<script>
    //    原生js不遍历
    var ele=document.getElementsByClassName("v1");
    for(var i=0;i<ele.length;i++){
        ele.onclick = function () {
            alert("66666")
        }
    }
    //    原生js不遍历
    var ele=document.getElementsByClassName("v1")[0];
    ele.onclick = function () {
        alert("66666")
    };

    function func(that) {
        //  对应的this标签
        console.log(that);
        //  this标签上面的标签
        console.log(that.previousElementSibling);
        //  this标签的父标签
        var r=that.parentNode;
        console.log(r);
        console.log('------------');
        var ch=r.children;
        console.log(ch)
    }

</script>
</body>
</html>